home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 295_01 / bgetb.c < prev    next >
Text File  |  1989-12-28  |  1KB  |  50 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "bgetb.c    1.2 - 89/10/31" */
  5.  
  6. /*#include <stddef.h>*/
  7. #include "blkio_.h"
  8.  
  9. /*man---------------------------------------------------------------------------
  10. NAME
  11.      bgetb - get a block from a block file
  12.  
  13. SYNOPSIS
  14.      #include <blkio.h>
  15.  
  16.      int bgetb(bp, bn, buf)
  17.      BLKFILE *bp;
  18.      bpos_t bn;
  19.      void *buf;
  20.  
  21. DESCRIPTION
  22.      The bgetb function reads block number bn from the block file
  23.      associated with BLKFILE pointer bp.  buf must point to a storage
  24.      area at least as large as the block size for bp.  Block numbering
  25.      starts at 1.
  26.  
  27.      bgetb will fail if one or more of the following is true:
  28.  
  29.      [EINVAL]       bp is not a valid BLKFILE pointer.
  30.      [EINVAL]       bn is less than 1.
  31.      [EINVAL]       buf is the NULL pointer.
  32.      [BEEOF]        There are not bn blocks in the file.
  33.      [BENOPEN]      bp is not open for reading.
  34.  
  35. SEE ALSO
  36.      bgetbf, bgeth, bputb.
  37.  
  38. DIAGNOSTICS
  39.      Upon successful completion, a value of 0 is returned.  Otherwise,
  40.      a value of -1 is returned, and errno set to indicate the error.
  41.  
  42. ------------------------------------------------------------------------------*/
  43. int bgetb(bp, bn, buf)
  44. BLKFILE *bp;
  45. bpos_t bn;
  46. void *buf;
  47. {
  48.     return bgetbf(bp, bn, (size_t)0, buf, bp->blksize);
  49. }
  50.